package com.adtech.adms.commons.file.pojo;

import java.util.Date;
import java.util.UUID;

/**
 * 
 * 
 * @author 李源 
 * @since 2011-8-15 
 * 
 * @Copyright (C) AD Tech Workshop All Right Reserved
 */
public class FileInfo {

	private String fileId;
	private Date dateTime;
	private String ext;
	private int length;
	private FileData fileData;
//	private FileType fileType;
	private String realName;
	private String realPath;
	//不存数据库，仅为展现使用
	private String aliasName;

	private String fileSize;
	private FileGroup group;
	
	public String getAid() {
		return UUID.randomUUID().toString();
	}
	
	/**
	 * #节点标识 节点标识映射到数据表中，区分数据属于哪个节点
	 *	#{网公司：center} {广东： gd} {广西：gx} {云南：yn} {海南：hz} {贵州：gz} {广州：gzo} {深圳：sz} {超高压：cgy} {调峰/调频：tftp}
	 */
	private String node;

	public String getRealName() {
		return realName;
	}
	public void setRealName(String realName) {
		this.realName = realName;
	}
	public String getRealPath() {
		return realPath;
	}
	public void setRealPath(String realPath) {
		this.realPath = realPath;
	}

	public FileData getFileData() {
		return fileData;
	}

	public void setFileData(FileData fileData) {
		this.fileData = fileData;
	}

	public String getFileId() {
		return fileId;
	}
	public void setFileId(String fileId) {
		this.fileId = fileId;
	}
	public Date getDateTime() {
		return dateTime;
	}

	public void setDateTime(Date dateTime) {
		this.dateTime = dateTime;
	}

	public String getExt() {
		return ext;
	}

	public void setExt(String ext) {
		this.ext = ext;
	}

	public int getLength() {
		return length;
	}

	public void setLength(int length) {
		this.length = length;
	}

//	public FileType getFileType() {
//		return fileType;
//	}
//	public void setFileType(FileType fileType) {
//		this.fileType = fileType;
//	}
	public String getAliasName() {
		return aliasName;
	}
	public void setAliasName(String aliasName) {
		this.aliasName = aliasName;
	}

	public String getNode() {
		return node;
	}
	public void setNode(String node) {
		this.node = node;
	}
	public String getFileSize() {
		return fileSize;
	}
	public void setFileSize(String fileSize) {
		this.fileSize = fileSize;
	}
	

	public FileGroup getGroup() {
		return group;
	}
	public void setGroup(FileGroup group) {
		this.group = group;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((fileId == null) ? 0 : fileId.hashCode());
		return result;
	}
	
	/*
	 * 很重要，用于判断附件是否存在于文件队列中
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		FileInfo other = (FileInfo) obj;
		if (fileId == null) {
			if (other.fileId != null)
				return false;
		} else if (!fileId.equals(other.fileId))
			return false;
		return true;
	}
	
	
}
